package com.ryskoo.permission.dept.domain;

import com.ryskoo.framework.core.bean.BasicPO;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "PMS_DEPT")
public class DeptPO extends BasicPO {

	private static final long serialVersionUID = -8245893002913546834L;

	/* 部门名称 */
	@Column(name = "name", length = 20)
	private String name;

	/* 上级部门ID */
	@Column(name = "parent_id", columnDefinition="character", length = 32)
	private String parentID;

	/* 子部门集合 */
	@Transient
	private List<DeptPO> childrens = new ArrayList<DeptPO>();

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getParentID() {
		return parentID;
	}

	public void setParentID(String parentID) {
		this.parentID = parentID;
	}

	public List<DeptPO> getChildrens() {
		return childrens;
	}

	public void setChildrens(List<DeptPO> childrens) {
		this.childrens = childrens;
	}

	@Override
	public String toString() {
		return new StringBuffer(super.toString()).append("DeptPO [name=")
				.append(name).append(", parentID=").append(parentID)
				.append("]").toString();
	}

}
